package org.monkey.example.request.entity.convert;


import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;
import org.monkey.example.request.entity.dto.RequestInfoDTO;
import org.monkey.example.request.entity.form.RequestInfoAddForm;
import org.monkey.example.request.entity.form.RequestInfoSaveForm;
import org.monkey.example.request.entity.form.RequestInfoUpdateForm;
import org.monkey.example.request.entity.po.RequestInfoPO;
import org.monkey.example.request.entity.vo.RequestInfoVO;
import org.monkey.request.plugin.entity.RequestInfo;

@Mapper(componentModel = "spring", nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
    nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface RequestInfoConvert {

  RequestInfoConvert INSTANT = Mappers.getMapper(RequestInfoConvert.class);

  RequestInfoVO dto2Vo(RequestInfoDTO source);

  RequestInfoDTO po2Dto(RequestInfoPO source);

  RequestInfoDTO addForm2Dto(RequestInfoAddForm source);

  RequestInfoPO dto2Po(RequestInfoDTO source);

  RequestInfoDTO updateForm2Dto(RequestInfoUpdateForm source);

  RequestInfoDTO saveForm2Dto(RequestInfoSaveForm source);

  @Mappings({
      @Mapping(target = "headers", expression = "java(source.hearToStringLimit(200))"),
      @Mapping(target = "customerData", expression = "java(source.customDataToStringLimit(200))")
  })
  RequestInfoAddForm convert2AddForm(RequestInfo source);
}
